package com.shengde.jinwawaforleader.model.myJob.teachResource;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ListView;

import com.shengde.jinwawaforleader.R;
import com.shengde.jinwawaforleader.model.myJob.adapter.MingshiShipinAdapter;
import com.shengde.jinwawaforleader.network.BaseProtocol;
import com.shengde.jinwawaforleader.network.protocolbean.ProVideoList;

import java.util.List;

public class MingshiShipinListActivity extends Activity {

	ListView listview;
	MingshiShipinAdapter adapter;
	public List<ProVideoList.DataListEntity> list;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_mingshi_shipin_list);

		findViewById(R.id.tv_back).setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});
		listview = (ListView) findViewById(R.id.today_list);
		listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				show_video(list.get(position).getLink());
			}
		});
		BaseProtocol.getInstance().getVideoList(this);
	}
	protected void show_video(String link) {
		// TODO Auto-generated method stub
		Intent aa = new Intent();
		aa.setClass(this, MingshiShipinDetailActivity.class);
		aa.putExtra("url",link);
		this.startActivity(aa);
	}
	public void updateData(){
		adapter = new MingshiShipinAdapter(list,MingshiShipinListActivity.this );
		listview.setAdapter(adapter);
	}
}
